package cn.yesway.module.customer.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.yesway.common.utils.UuidUtils;
import cn.yesway.module.customer.dao.CustomerDao;
import cn.yesway.module.customer.service.CustomerService;
import cn.yesway.module.customer.vo.Customer;

@Service
public class CustomerServiceImpl implements CustomerService {

	@Autowired
	CustomerDao customerDao;

	@Override
	public List<Customer> getAll() {
		return customerDao.getAll();
	}

	@Override
	public Customer getById(String id) {
		return customerDao.getById(id);
	}

	@Override
	public int addCustomer(Customer c) {
		c.setId(UuidUtils.getUUID());
		return customerDao.add(c);
	}

	@Override
	public int updateCustomer(Customer c) {
		return customerDao.update(c);
	}

	@Override
	public List<Customer> getByCondition(String name) {
		return customerDao.getByCondition(name);
	}

	@Override
	public int deleteCustomer(String id) {
		return customerDao.delete(id);
	}

}
